﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace zielonka.co.uk.extensions.system
{
    //Description:	Returns the current local time for the specified time zone.
    /*
        static int Main()
        {
            ReadOnlyCollection<TimeZoneInfo> arrTzi = TimeZoneInfo.GetSystemTimeZones();
            foreach(TimeZoneInfo tzinfo in arrTzi)
            {
                DateTime dt = tzinfo.CurrentLocalTimeForTimeZone();
                Console.Write(tzinfo.Id);
                Console.Write(" ");
                Console.Write(tzinfo.DisplayName);
                Console.Write(" : ");
                Console.WriteLine(dt.ToString("F"));
            }
            return 0;
        }
    */

    public static partial class TimeZoneInfoExtensions
    {
        public static DateTime CurrentLocalTimeForTimeZone(this TimeZoneInfo tzi)
        {
            return TimeZoneInfo.ConvertTimeBySystemTimeZoneId(DateTime.Now, tzi.Id);
        }
    }
}
